use container_core::process::SimpleProcessManager;
use model_graph_types::{
    connector::{Connector, QueryOptions},
    container::process::{CommandProcessOptions, Process, ProcessManager, ProcessOptions},
    database::{ConnectorProtocol, DataSource, DatabaseType},
    extractor::{ExtractFromDatabaseOption, MetadataExtractor, MetadataPackage},
    modeling::{Class, ModelingReader, ModelingWriter},
};

#[tokio::main]
async fn main() {
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::DEBUG)
        .init();
    tracing::info!("RRAI 启动...");

    let manager = SimpleProcessManager {};

    let java_cmd = ProcessOptions::Command(CommandProcessOptions {
        command: String::from("java -jar /Users/suhs/rrkeji/model-graph/applications/jdbc-bridge/target/jdbc-bridge-1.0.0.jar"),
        args: vec![],
    });
    let identifier = String::from("java");

    let pid_options = manager.start(&identifier, &java_cmd).await;

    match pid_options {
        Ok(result) => {
            tracing::debug!("!!!!!!{:?}", result);
        }
        Err(err) => tracing::debug!("===-----{:?}", err),
    }
    std::thread::sleep(std::time::Duration::from_secs(10000000));
    //
    let r = manager.stop(&identifier).await.unwrap();

    tracing::debug!("完成:{}", r);
}
